import { handle } from '../../index'

const suffix = 'api'

// 验证码
export const captcha = () => handle({
  url: `/${suffix}/captcha`,
  method: 'get',
})
// 登录
export const login = (params: any) => handle({
  url: `/${suffix}/login`,
  method: 'post',
  params
})
// 验证码
export const getCurrentUser = () => handle({
  url: `/${suffix}/getCurrentUser`,
  method: 'get',
})
// 分页列表
export const usersGetPageUser = (params: any) => handle({
  url: `/${suffix}/users/getPageUser`,
  method: 'get',
  params
})
// 详情
export const usersGetUserById = (id: any) => handle({
  url: `/${suffix}/users/getUserById/${id}`,
  method: 'get',
})
// 新增
export const usersRegister = (params: any) => handle({
  url: `/${suffix}/users/register`,
  method: 'post',
  params
})
// 编辑
export const usersUpdate = (params: any) => handle({
  url: `/${suffix}/users/update`,
  method: 'post',
  params
})
// 修改密码
export const usersUpdatePassword = (params: any) => handle({
  url: `/${suffix}/users/updatePassword`,
  method: 'post',
  params
})
// 删除
export const usersDeleteUser = (id: any) => handle({
  url: `/${suffix}/users/deleteUser/${id}`,
  method: 'get',
})
// 查看授权
export const usersGetAuthorization = (id: any) => handle({
  url: `/${suffix}/users/getAuthorization/${id}`,
  method: 'get',
})
// 授权
export const usersDoAuthorization = (params: any) => handle({
  url: `/${suffix}/users/doAuthorization`,
  method: 'post',
  params
})